<template>
  <div class="_wz_cent_main">
    <vue-tinymce v-model="tinymce" :setup="setup" :setting="setting" />
  </div>
</template>
<script>
export default {
  props: ['htmlData','height'],//接收来自父组件的数据
  data() {
    return {
      tinymce:'',
      setting: {
        // // menubar: false,
        // toolbar: "undo redo | fullscreen | formatselect alignleft aligncenter alignright alignjustify | link unlink | numlist bullist | image media table | fontselect fontsizeselect forecolor backcolor | bold italic underline strikethrough | indent outdent | superscript subscript | removeformat |",
        // toolbar_drawer: "sliding",
        // quickbars_selection_toolbar: "removeformat | bold italic underline strikethrough | fontsizeselect forecolor backcolor",
        // plugins: "link image media table lists fullscreen quickbars",



        plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern  emoticons autosave autoresize',
        toolbar: 'code undo redo restoredraft | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify outdent indent | styleselect formatselect fontsizeselect | bullist numlist | table image hr pagebreak insertdatetime print preview | fullscreen | bdmap indent2em lineheight formatpainter axupimgs importword kityformula-editor',
        fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',

        images_upload_handler: function (blobInfo, succFun, failFun) {
          var file = blobInfo.blob();//转化为易于理解的file对象
          // console.log(window.URL.createObjectURL(file))
          succFun(window.URL.createObjectURL(file));
        },
        min_height: this.height,
        language: "zh_CN",
        language_url: "../../static/tinymce/langs/zh_CN.js",//使用language_url会相对灵活
        height: this.height
      },

    }
  },
  computed: {//计算属性

  },
  beforeCreate() {//beforeCreate创建前状态

  },
  created() {//created创建完毕状态

  },
  beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

  },
  mounted() {//mounted 挂载结束状态

  },
  methods: {//执行的方法
    setup(editor) {
      // console.log(editor)
    },
  },
  watch: {//监听
    htmlData(news,old){
      this.tinymce = this.htmlData;
    },
    tinymce(news,old){
      this.$emit('tinymceData', news)
    },
  },
  beforeUpdate() {//beforeUpdate 更新前状态

  },
  updated() {//updated 更新完成状态

  },
  beforeDestroy() {//beforeDestroy 销毁前状态

  },
  destroyed() {//destroyed 销毁完成状态

  }
}
</script>
<style lang="less">

</style>
